﻿USE [projecturo]
GO
/****** Object:  ForeignKey [FK_Category_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Category_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Category]'))
ALTER TABLE [dbo].[Category] DROP CONSTRAINT [FK_Category_Project]
GO
/****** Object:  ForeignKey [FK_Ticket_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Ticket_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Ticket]'))
ALTER TABLE [dbo].[Ticket] DROP CONSTRAINT [FK_Ticket_Project]
GO
/****** Object:  ForeignKey [FK_User_DataContext]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_User_DataContext]') AND parent_object_id = OBJECT_ID(N'[dbo].[User]'))
ALTER TABLE [dbo].[User] DROP CONSTRAINT [FK_User_DataContext]
GO
/****** Object:  ForeignKey [FK_UserProject_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject] DROP CONSTRAINT [FK_UserProject_Project]
GO
/****** Object:  ForeignKey [FK_UserProject_User]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_User]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject] DROP CONSTRAINT [FK_UserProject_User]
GO
/****** Object:  ForeignKey [FK_Version_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Version_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Version]'))
ALTER TABLE [dbo].[Version] DROP CONSTRAINT [FK_Version_Project]
GO
/****** Object:  Table [dbo].[UserProject]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject] DROP CONSTRAINT [FK_UserProject_Project]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_User]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject] DROP CONSTRAINT [FK_UserProject_User]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserProject]') AND type in (N'U'))
DROP TABLE [dbo].[UserProject]
GO
/****** Object:  Table [dbo].[Version]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Version_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Version]'))
ALTER TABLE [dbo].[Version] DROP CONSTRAINT [FK_Version_Project]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Version]') AND type in (N'U'))
DROP TABLE [dbo].[Version]
GO
/****** Object:  Table [dbo].[Ticket]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Ticket_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Ticket]'))
ALTER TABLE [dbo].[Ticket] DROP CONSTRAINT [FK_Ticket_Project]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Ticket]') AND type in (N'U'))
DROP TABLE [dbo].[Ticket]
GO
/****** Object:  Table [dbo].[User]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_User_DataContext]') AND parent_object_id = OBJECT_ID(N'[dbo].[User]'))
ALTER TABLE [dbo].[User] DROP CONSTRAINT [FK_User_DataContext]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[User]') AND type in (N'U'))
DROP TABLE [dbo].[User]
GO
/****** Object:  Table [dbo].[Category]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Category_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Category]'))
ALTER TABLE [dbo].[Category] DROP CONSTRAINT [FK_Category_Project]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Category]') AND type in (N'U'))
DROP TABLE [dbo].[Category]
GO
/****** Object:  Table [dbo].[DataContext]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DataContext]') AND type in (N'U'))
DROP TABLE [dbo].[DataContext]
GO
/****** Object:  Table [dbo].[Project]    Script Date: 07/20/2009 21:00:01 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Project]') AND type in (N'U'))
DROP TABLE [dbo].[Project]
GO
/****** Object:  Table [dbo].[Project]    Script Date: 07/20/2009 21:00:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Project]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Project](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
	[Description] [nvarchar](max) NULL,
	[CreateDate] [datetime] NULL,
	[ChangeDate] [datetime] NULL,
	[CreatedById] [bigint] NULL,
	[ChangedById] [bigint] NULL,
 CONSTRAINT [PK_Project] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[DataContext]    Script Date: 07/20/2009 21:00:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DataContext]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DataContext](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
 CONSTRAINT [PK_DataContext] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[Category]    Script Date: 07/20/2009 21:00:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Category]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Category](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
	[Description] [nvarchar](max) NULL,
	[ChangeDate] [datetime] NULL,
	[CreateDate] [datetime] NULL,
	[CreatedById] [bigint] NULL,
	[ChangedById] [bigint] NULL,
	[ProjectId] [bigint] NULL,
 CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[User]    Script Date: 07/20/2009 21:00:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[User]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[User](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[FirstName] [nvarchar](100) NULL,
	[LastName] [nvarchar](100) NULL,
	[ShortName] [nvarchar](12) NULL,
	[Username] [nvarchar](100) NULL,
	[Password] [nvarchar](50) NULL,
	[Role] [int] NULL,
	[IsActive] [bit] NULL,
	[DataContextId] [bigint] NULL,
	[ChangeDate] [datetime] NULL,
	[CreateDate] [datetime] NULL,
	[ChangedById] [bigint] NULL,
	[CreatedById] [bigint] NULL,
 CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[Ticket]    Script Date: 07/20/2009 21:00:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Ticket]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Ticket](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
	[Description] [nvarchar](max) NULL,
	[ChangeDate] [datetime] NULL,
	[CreateDate] [datetime] NULL,
	[ChangedById] [bigint] NULL,
	[CreatedById] [bigint] NULL,
	[CategoryId] [bigint] NULL,
	[VersionId] [bigint] NULL,
	[Type] [int] NULL,
	[Priority] [int] NULL,
	[State] [int] NULL,
	[ProjectId] [bigint] NULL,
	[AssignedToId] [bigint] NULL,
 CONSTRAINT [PK_Ticket] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[Version]    Script Date: 07/20/2009 21:00:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Version]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Version](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
	[Description] [nvarchar](max) NULL,
	[CreateDate] [datetime] NULL,
	[ChangeDate] [datetime] NULL,
	[CreatedById] [bigint] NULL,
	[ChangedById] [bigint] NULL,
	[ProjectId] [bigint] NULL,
 CONSTRAINT [PK_Version] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[UserProject]    Script Date: 07/20/2009 21:00:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserProject]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[UserProject](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[UserId] [bigint] NULL,
	[ProjectId] [bigint] NULL,
 CONSTRAINT [PK_UserProject] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  ForeignKey [FK_Category_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Category_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Category]'))
ALTER TABLE [dbo].[Category]  WITH CHECK ADD  CONSTRAINT [FK_Category_Project] FOREIGN KEY([ProjectId])
REFERENCES [dbo].[Project] ([Id])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Category_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Category]'))
ALTER TABLE [dbo].[Category] CHECK CONSTRAINT [FK_Category_Project]
GO
/****** Object:  ForeignKey [FK_Ticket_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Ticket_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Ticket]'))
ALTER TABLE [dbo].[Ticket]  WITH CHECK ADD  CONSTRAINT [FK_Ticket_Project] FOREIGN KEY([ProjectId])
REFERENCES [dbo].[Project] ([Id])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Ticket_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Ticket]'))
ALTER TABLE [dbo].[Ticket] CHECK CONSTRAINT [FK_Ticket_Project]
GO
/****** Object:  ForeignKey [FK_User_DataContext]    Script Date: 07/20/2009 21:00:01 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_User_DataContext]') AND parent_object_id = OBJECT_ID(N'[dbo].[User]'))
ALTER TABLE [dbo].[User]  WITH CHECK ADD  CONSTRAINT [FK_User_DataContext] FOREIGN KEY([DataContextId])
REFERENCES [dbo].[DataContext] ([Id])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_User_DataContext]') AND parent_object_id = OBJECT_ID(N'[dbo].[User]'))
ALTER TABLE [dbo].[User] CHECK CONSTRAINT [FK_User_DataContext]
GO
/****** Object:  ForeignKey [FK_UserProject_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject]  WITH CHECK ADD  CONSTRAINT [FK_UserProject_Project] FOREIGN KEY([ProjectId])
REFERENCES [dbo].[Project] ([Id])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject] CHECK CONSTRAINT [FK_UserProject_Project]
GO
/****** Object:  ForeignKey [FK_UserProject_User]    Script Date: 07/20/2009 21:00:01 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_User]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject]  WITH CHECK ADD  CONSTRAINT [FK_UserProject_User] FOREIGN KEY([UserId])
REFERENCES [dbo].[User] ([Id])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UserProject_User]') AND parent_object_id = OBJECT_ID(N'[dbo].[UserProject]'))
ALTER TABLE [dbo].[UserProject] CHECK CONSTRAINT [FK_UserProject_User]
GO
/****** Object:  ForeignKey [FK_Version_Project]    Script Date: 07/20/2009 21:00:01 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Version_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Version]'))
ALTER TABLE [dbo].[Version]  WITH CHECK ADD  CONSTRAINT [FK_Version_Project] FOREIGN KEY([ProjectId])
REFERENCES [dbo].[Project] ([Id])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Version_Project]') AND parent_object_id = OBJECT_ID(N'[dbo].[Version]'))
ALTER TABLE [dbo].[Version] CHECK CONSTRAINT [FK_Version_Project]
GO
INSERT INTO [projecturo_dev].[dbo].[User]
           ([FirstName]
           ,[LastName]
           ,[ShortName]
           ,[Username]
           ,[Password]
           .[Role]
           ,[IsActive])
     VALUES
           ('admin'
           ,'admin'
           ,'adm'
           ,'admin'
           ,'admin'
           ,1
           ,true)
GO

--Projecturo 0.0.2

CREATE TABLE [dbo].[TimeRecord](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NULL,
	[Description] [nvarchar](max) NULL,
	[StartDate] [datetime] NULL,
	[EndDate] [datetime] NULL,
	[TicketId] [bigint] NULL,
	[CreateDate] [datetime] NULL,
	[CreatedById] [bigint] NULL,
 CONSTRAINT [PK_TimeRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

CREATE TABLE [dbo].[Note](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Message] [nvarchar](max) NULL,
	[TicketId] [bigint] NULL,
	[ChangeDate] [datetime] NULL,
	[CreateDate] [datetime] NULL,
	[ChangedById] [bigint] NULL,
	[CreatedById] [bigint] NULL,
 CONSTRAINT [PK_Note] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Ticket]
ADD   ExpectedEffortHours INT NULL

GO

CREATE TABLE [dbo].[TicketState](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
	[Color] [nvarchar](9) NULL,
	[IsActive] [bit] NULL,
	[CreateDate] [datetime] NULL,
	[ChangeDate] [datetime] NULL,
	[CreatedById] [bigint] NULL,
	[ChangedById] [bigint] NULL,
	[ProjectId] [bigint] NULL,
	[DataContextId] [bigint] NULL,
 CONSTRAINT [PK_TaskState] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

CREATE TABLE [dbo].[Milestone](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NULL,
	[FinishingDate] [datetime] NULL,
	[CreateDate] [datetime] NULL,
	[ChangeDate] [datetime] NULL,
	[CreatedById] [bigint] NULL,
	[ChangedById] [bigint] NULL,
	[ProjectId] [bigint] NULL,
	[DataContextId] [bigint] NULL,
 CONSTRAINT [PK_Milestone] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Ticket]
ADD   TicketStateId BIGINT NULL

GO

INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('New','#FFF53030',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Assigned','#FFA29DE1',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Accepted','#FF564AEB',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Started','#FF3526F9',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Reviewable','#FF5AF167',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Resolved','#FF00F515',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Closed','#FFCCF1D0',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Feedback','#FFB0B0B0',1)
INSERT INTO [projecturo_dev].[dbo].[TicketState] ([Name] ,[Color] ,[IsActive]) VALUES ('Halted','#FFFF00A2',1)
GO

ALTER TABLE [dbo].[Milestone]
ADD Description nvarchar(max) NULL

GO

ALTER TABLE [dbo].[Ticket]
ADD	MilestoneId BIGINT NULL

GO

ALTER TABLE [dbo].[Project]
ADD DefaultTicketStateId BIGINT NULL

GO
